package com.atguigu.gmall.all.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.order.client.OrderFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.Map;

/**
 * @author lfh
 * @version 1.0
 * @date 2021/4/28 16:25
 */
@Controller
public class OrderController {

    @Autowired
    private OrderFeignClient orderFeignClient;

    // http://order.gmall.com/trade.html
    // String 因为回显一个页面
    // model 想拿到result里面的数据map，拿到result的data，拿到data相当于拿到map
    @GetMapping("trade.html")
    private String trade(Model model){
        Result<Map<String, Object>> result = orderFeignClient.trade();

        model.addAllAttributes(result.getData());
        return "order/trade";
    }
}
